package com.thinkersre.event.mail;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MailProducer {
    @Resource
    private KafkaTemplate kafkaTemplate;

    @Resource
    private MailClientNew mailClientNew;
//    public void fireMail(Mail mail) {
//        kafkaTemplate.send("mail", JSONObject.toJSONString(mail));
//    }

    public void fireMail(Mail mail){
        mailClientNew.sendMail(mail);
    }

}
